{ config, pkgs, lib, ... }: {
	imports =
		[ 
		./hardware-configuration.nix
			"${builtins.fetchTarball https://github.com/rycee/home-manager/archive/release-19.09.tar.gz}/nixos"
		];
	hardware.opengl.driSupport32Bit = true;
	hardware.pulseaudio.enable = true;
	hardware.opengl.driSupport = true;
	boot = {
		plymouth.enable = true;
		plymouth.logo   = /home/jahor/.config/gnu.png;
		loader = {
			grub.device      = "/dev/sda";
			grub.enable      = true;
			grub.gfxmodeBios = "1920x1080";
			grub.gfxpayloadBios = "1920x1080";
		};
	};

	networking.hostName = "nixos"; 

	time.timeZone = "Europe/Minsk";

	i18n = {
		consoleKeyMap = "us";
		consoleFont = "Lat2-Terminus16";
		defaultLocale = "en_US.UTF-8";
	};

	programs.adb.enable = true;
	programs.zsh = {
		enable = true;
		autosuggestions.enable = true;
		enableCompletion = true;
		syntaxHighlighting.enable = true;
		shellAliases = {
			"vim" = "nvim";};
	};
	users.users.jahor = {
		shell = pkgs.zsh;
		isNormalUser = true;
		extraGroups = [ "sway" "mpd" "wheel" "adbusers"]; 
	};
	
	nixpkgs.config = {
		allowUnfree      = true;
		allowBroken      = true;
		packageOverrides = pkgs: { unstable = import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz){ config = config.nixpkgs.config; }; };
	};
	fonts.fonts = with pkgs; [
		inconsolata
			source-code-pro
			monoid
			symbola
			fantasque-sans-mono
			hasklig
			terminus_font_ttf
			junicode
			terminus
			ipafont
			kochi-substitute
			(pkgs.iosevka.overrideAttrs (oldAttrs: { 
						     set    = "term";
						     design = [
						     "term"
						     "v-l-italic" 
						     "v-i-italic" 
						     "v-g-singlestorey" 
						     "v-zero-dotted" 
						     "v-asterisk-high" 
						     "v-at-long" 
						     "v-brace-straight"];}))
			];

	environment.systemPackages = with pkgs; [
		(import ./contrib/freetube.nix)
			unrar
			mpd
			mpc_cli
			ncmpcpp
#(wine.override { wineBuild = "wineWow"; })
			shutter 
			xmobar
			xclip
			qemu
			aqemu
			qt5.full
			maim
			steam-run
			(pkgs.multimc.overrideAttrs (oldAttrs: {
						     version = "0.6.11";
						     src = fetchFromGitHub {
						     owner = "MultiMC";
						     repo = "MultiMC5";
						     rev = "3ad9ea5";
						     sha256 = "1jkbmb4sgfk8d93f5l1vd9pkpvhq9sxacc61w0rvf5xmz0wnszmz";
						     fetchSubmodules = true;
						     };}))
	xorg.xrandr
		openjdk
		steam
		ranger
		texlive.combined.scheme-full
		nix-prefetch-scripts
		git
		neovim
		zathura
		killall
		firefox
		browsh
		qutebrowser
		st
		(dmenu.override { patches = [./contrib/vert.diff];})
		stack
		(haskellPackages.ghcWithPackages (ps: with ps; [hoogle hlint sdl2 GLUtil GLFW-b gloss]))
		wget 
		unzip
		kitty
		libreoffice 
		any-nix-shell
		gimp 
		qbittorrent 
		vlc 
		feh 
		xkb-switch
		palemoon
		emacs
		xdotool 
		jmtpfs 
		youtube-dl 
		compton
		neofetch
		xorg.libxcb
		ntfs3g 
		];

	services = {
		mingetty = { helpLine = ''Welcome to NixOS! '';
			greetingLine     = '']P0232c31]P12a5491]P2237986]P3a03b1e]P4484d79]P5c59820]P6b02f30]P79ea7a6]P83f4944]P92a5491]PA237986]PBa03b1e]PC484d79]PDc59820]PEb02f30]PFb5d8f6[2J''; };
		dbus.packages    = with pkgs; [gnome3.dconf];
		openssh.enable   = true;
		mpd = {
			group          = "users";
			user           = "jahor";
			enable         = true;
			musicDirectory = "/home/jahor/mus/";
			dataDir        = "/home/jahor/.config/mpd";
			extraConfig    = ''
				audio_output {
					type                    "alsa"
						name                    "Sound Card"
						options                 "dev=dmixer"
						device                  "plug:dmix"
				}
			auto_update "yes"
				'';
		};
		printing = {
			enable  = true;    
			drivers = [pkgs.foo2zjs];
		};
	};

	sound.enable = true;

	home-manager.users.jahor = {pkgs, ...}: {
		home.file.".xinitrc".text = ''
			exec compton --vsync --backend glx &
			exec xsetroot -cursor_name left_ptr &
			exec feh --bg-tile /home/jahor/.config/bg.png &
			xmonad'';
	};

	services.xserver = {
		videoDrivers = [ "nvidia" ];                   

		layout = "by(latin),ru";
		xkbOptions = "grp:toggle, grp_led:scroll, ctrl:swapcaps";

		enable = true;

		displayManager = {
			startx.enable = true;
		};
		windowManager.xmonad = {
			enable = true;
			enableContribAndExtras = true;
		};
	};

	system = {
		stateVersion = "19.09"; 
	};

			    }
